Fix #18670 - Default arguments bypass most attribute checks#22908
Fix #18670 - Default arguments bypass most attribute checks#22908dkorpel wants to merge 2 commits intodlang:masterfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
| .deprecation(loc, "`pure` %s `%s` accessing mutable static data `%s` in default argument", | ||
| sc.func.kind(), sc.func.toPrettyChars(), v.toErrMsg()); | ||
| else | ||
| { | ||
| error(loc, "`pure` %s `%s` cannot access mutable static data `%s`", | ||
| sc.func.kind(), sc.func.toPrettyChars(), v.toErrMsg()); |
There was a problem hiding this comment.
any reason not to use previewErrorFunc here?
There was a problem hiding this comment.
I'm trying to get something basic working here before making it nice and tidy. The more pressing issue currently is that void defaultUnsafe2(int x = globalPtr[1]) @safe still gives an Error instead of a Deprecation. I'll mark it as ready for review and ping once it's in a good state.
| { | ||
| if (useDeprecation) | ||
| { | ||
| .deprecation(loc, "`pure` %s `%s` calling impure %s `%s` in default argument", |
| if (!f.isDtorDeclaration()) | ||
| errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.pure_, global.errorSink); |
There was a problem hiding this comment.
why is the supplemental not printed for a deprecation?
| if (useDeprecation) | ||
| { | ||
| // Introduced in 2.113 | ||
| .deprecation(loc, "`@safe` %s `%s` calling `@system` %s `%s` in default argument", |
No description provided.